package edu.gatech.cs2340.teamrocket.model.stats;

import java.io.Serializable;

/**
 * Holds miscellaneous numbers that do not affect the progress of the game.
 *
 * @author Joe Tacheron
 */
public class Stats implements Serializable {

    private int turn;
    private long score;
    private transient String ipAddress;
    private transient String username;
    private transient String password;

    public Stats(){
        turn = 1;
    }

    public int getTurn(){
        return turn;
    }

    public long getScore(){
        return score;
    }

    public String getIP(){
        return ipAddress;
    }

    public String getUsername(){
        return username;
    }

    public String getPassword(){
        return password;
    }

    public void incTurn(){
        turn++;
    }

    public void incScore(long amount){
        score += amount;
    }

    public void setIP(String ip){
        ipAddress = ip;
    }

    public void setUsername(String user){
        username = user;
    }

    public void setPassword(String pass){
        password = pass;
    }

    /**
     *
     * @return a String representation of this object in HTML format.
     */
    public String toHTML(){
        StringBuilder retval = new StringBuilder();
        retval.append("<html>");
        /**/retval.append("<p>");
        /**//**/retval.append("Turn: ");
        /**//**/retval.append(turn);
        /**/retval.append("</p>");
        /**/retval.append("<p>");
        /**//**/retval.append("Score: ");
        /**//**/retval.append(score);
        /**/retval.append("</p>");
        if(ipAddress != null){
        /**/retval.append("<p>");
        /**//**/retval.append("IP Address: ");
        /**//**/retval.append(ipAddress);
        /**/retval.append("</p>");
        }
        if(username != null){
        /**/retval.append("<p>");
        /**//**/retval.append("Username: ");
        /**//**/retval.append(username);
        /**/retval.append("</p>");
        }
        if(password != null){
        /**/retval.append("<p>");
        /**//**/retval.append("Password: ");
        /**//**/retval.append(password);
        /**/retval.append("</p>");
        }
        retval.append("</html>");
        return retval.toString();
    }
}
